Skip to content

Let journal entries be edited in the TUI - #266

Merged
robzolkos merged 2 commits into
mainfrom
tui-journal-editor
Aug 22, 2026
Merged

robzolkos merged 2 commits into
mainfrom
tui-journal-editor

Conversation

@robzolkos

@robzolkos robzolkos commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Journal readers can create or edit the selected day without leaving the TUI, while preserving rich journal HTML, keeping repeated saves structurally stable, and preventing failed reads from opening an unsafe blank editor.

Review readiness: ✅ Yes
Risk: 🟡 Medium — journal writes can replace rich content, so the editor round-trips HEY’s editable HTML and keeps failed drafts open
Decision: None

✅ Change — selected journal days can be created, updated, or removed

Before

Journal reader selects a day
└── Reads the entry
    └── ❌ No TUI write path

After

Journal reader selects a day
└── Presses e
    └── Edits the selected day
        └── Presses ctrl+s
            └── ✅ Entry is created, updated, or removed  ← CHANGED

The form uses e to edit, ctrl+s to save, and esc to cancel. An empty save mirrors hey journal write by removing the day’s entry.

✅ Evidence — focused behavior and repository checks pass locally
  • ✅ Focused journal tests cover form routing, create/update/removal, repeated wrapper-free save cycles, rich HTML and attachment preservation, literal plain-text fallback, failed reads, failed saves, help bindings, and notice layout.
  • ✅ Three no-op edit/save cycles against a real journal reduced three accumulated trix-content wrappers to the server’s single presentation wrapper and kept the normalized text unchanged.
  • ✅ Interaction recording shows opening the selected day with e, editing it without presentation wrappers, saving with ctrl+s, and repeating an unchanged save without wrapper growth.

Journal editor interaction recording

GOWORK=off go test ./internal/tui -run 'TestJournal' -count=1
ok github.com/basecamp/hey-cli/internal/tui

GOWORK=off make test
PASS

GOWORK=off make lint
0 issues

GOWORK=off make fmt-check vet tidy-check
PASS
✅ Scope — existing SDK operations and CLI behavior stay authoritative

Included: TUI editing for the selected journal day, successful-save refresh, stable removal of trix-content presentation wrappers before updates, rich-content preservation, and recoverable save errors.

Not included: a rich-text terminal editor or SDK/API changes. Existing CLI journal behavior is unchanged.

➖ Delivery — no migration, configuration, dependency, or rollout work

The change uses the existing Journal().Get and Journal().Update operations. Rollback is a code revert.

✅ Review decision — no unresolved decision

Rich entries appear as editable HTML without HEY’s trix-content presentation containers, so repeated unchanged saves retain links, formatting, and attachments without accumulating wrappers. Review should begin with that token-preserving normalization and with failed-read and failed-save handling before the form lifecycle.

✅ Review path — journal flow, form, then behavioral coverage
  1. internal/tui/journal.go — read/write flow and request-lane handling
  2. internal/tui/journal_form.go — textarea behavior and key bindings
  3. internal/tui/journal_test.go — behavioral and failure-state evidence

Origin and supporting links: Basecamp card

@robzolkos
robzolkos marked this pull request as ready for review August 22, 2026 02:38
@robzolkos
robzolkos requested a review from a team as a code owner August 22, 2026 02:38
Copilot AI balanced review requested due to automatic review settings August 22, 2026 02:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds in-TUI journal editing while preserving rich HTML and handling read/write failures safely.

Changes:

  • Adds journal edit, save, cancel, and removal flows.
  • Preserves editable HTML and refreshes entries after saves.
  • Adds focused journal editor tests.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/tui/journal.go Implements journal loading, editing, saving, and notices.
internal/tui/journal_form.go Adds the journal textarea form and key bindings.
internal/tui/journal_test.go Covers editor lifecycle, rich content, and failures.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/tui/journal.go Outdated
@robzolkos
robzolkos merged commit 9ac790d into main Aug 22, 2026
23 checks passed
@robzolkos
robzolkos deleted the tui-journal-editor branch August 22, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants